package io.openmessaging.storage.dledger.protocol;

import java.util.concurrent.CompletableFuture;

/**
 * Both the RaftLogServer(inbound) and RaftRpcService (outbound) should implement this protocol
 * DLedger 客户端协议处理器
 */
public interface DLedgerClientProtocolHandler {

    // Leader 节点处理客户端日志写入请求
    CompletableFuture<AppendEntryResponse> handleAppend(AppendEntryRequest request) throws Exception;

    //
    CompletableFuture<GetEntriesResponse> handleGet(GetEntriesRequest request) throws Exception;

    //
    CompletableFuture<MetadataResponse> handleMetadata(MetadataRequest request) throws Exception;

    //
    CompletableFuture<LeadershipTransferResponse> handleLeadershipTransfer(LeadershipTransferRequest leadershipTransferRequest) throws Exception;
}
